//
//  QZOtherMyVC.m
//  shortvideoplay
//
//  Created by adam on 2024/6/23.
//

#import "QZOtherMyVC.h"
#import "GKPageScrollView.h"
#import "JXCategoryView.h"
#import "QZOtherMyMessegeView.h"
#import "QZOtherMyVideoVC.h"
#import "QZMyLikeVC.h"
#import "QZMyCollectionVC.h"
#import "SharePopView.h"
#import "DJJubaoVC.h"
#import "CSJADLoading.h"
#import "QZMyFansVC.h"
#import "QZOtherMyBlackVC.h"
#import "QZOtherMyPriVC.h"
#import "QZMyTitleView.h"

@interface QZOtherMyVC ()<GKPageScrollViewDelegate,JXCategoryViewDelegate,SharePopViewDelegate>
@property (nonatomic, strong) GKPageScrollView      *pageScrollView;
@property (nonatomic, strong) JXCategoryIndicatorLineView *lineView;
@property (nonatomic, strong) QZOtherMyMessegeView        *headerView;

@property (nonatomic, strong) QZMyTitleView   *categoryView;

@property (nonatomic, strong) NSArray               *titles;
@property (nonatomic, strong) NSArray               *images;

@property (nonatomic, strong) UILabel               *titleView;

@property (nonatomic, strong) QZUserInfoModel               *infoModel;

@property (nonatomic, strong) UIView                *navView;
@property (nonatomic, strong) UIButton              *navBack;
@property (nonatomic, strong) UIButton              *navMore;
@property (nonatomic, strong) UIView                *navMessegeView;
@property (nonatomic, strong) UIImageView           *navMessegeFace;
@property (nonatomic, strong) UILabel               *navMessegeNick;

@property (nonatomic, strong)UIView * other_see_view;
@property (nonatomic, strong)UILabel * other_see_label;
@property (nonatomic, strong)UIImageView * other_see_image;
@property (nonatomic, assign)BOOL          isOtherSeeStatus;
@property (nonatomic, strong)QZOtherMyVideoVC * otherVideoVC;

@property (nonatomic, strong) UIView * adView;
@end

@implementation QZOtherMyVC
- (void)updateOtherFollow:(id)followId isFollow:(id)isFollow{
    if([followId intValue] == [self.infoModel.mid intValue]){
        self.infoModel.isfollow = isFollow;
        if ([isFollow intValue] == 1) {
            self.infoModel.total_fans = @([self.infoModel.total_fans integerValue]+1);
        }else{
            self.infoModel.total_fans = @([self.infoModel.total_fans integerValue]-1);
        }
        [self.headerView refreshMessege:self.infoModel];
    }
}
-(void)showTextViewNavViewTo1{
    NSMutableArray * showTextViewNavViewNameArrTo1 = [NSMutableArray new];
    UIView * showTextViewNavViewViewTo1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    showTextViewNavViewViewTo1.clipsToBounds = YES;
       UILabel * oldshowSSSSTip = [[UILabel alloc]init];
    oldshowSSSSTip.clipsToBounds = YES;
    oldshowSSSSTip.text = @"kass显示区";
    oldshowSSSSTip.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip.hidden = YES;
    [self.view addSubview:oldshowSSSSTip];
    [self.view addSubview:showTextViewNavViewViewTo1];
    UILabel * showTextViewNavViewLabelTo1 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    NSInteger showTextViewNavViewNumberTo1 = arc4random_uniform(20);
    NSLog(@"：%ld", (long)showTextViewNavViewNumberTo1);
    showTextViewNavViewLabelTo1.text = [NSString stringWithFormat:@"%ld",(long)showTextViewNavViewNumberTo1];
    [showTextViewNavViewLabelTo1 addSubview:showTextViewNavViewLabelTo1];
    
    UIImageView * showTextViewNavViewLabelTo2 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    [showTextViewNavViewViewTo1 addSubview:showTextViewNavViewLabelTo2];
}
- (void)showOldAddNavViewToMainOldView1{
    UIView * oldBgSS = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    oldBgSS.clipsToBounds = YES;
       UILabel * oldshowSSSSTip = [[UILabel alloc]init];
    oldshowSSSSTip.clipsToBounds = YES;
    oldshowSSSSTip.text = @"kass显示区";
    oldshowSSSSTip.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip.hidden = YES;
    [self.view addSubview:oldshowSSSSTip];
    [self.view addSubview:oldBgSS];
    
    UIButton * sendBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreen_W-75, kStatusBarHeight+10, 60, 46)];
    sendBtn.layer.cornerRadius = 3;
    sendBtn.backgroundColor = [UIColor whiteColor];
    [sendBtn setTitle:@"发送" forState:UIControlStateNormal];
    [sendBtn setTitleColor:ColorHex(@"#333333") forState:UIControlStateNormal];
    sendBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [sendBtn addTarget:self action:@selector(sendTap) forControlEvents:UIControlEventTouchUpInside];
    [oldBgSS addSubview:sendBtn];
    
    UIView * sendBg = [[UIView alloc]initWithFrame:CGRectMake(15, kStatusBarHeight+66, KScreen_W-30, (KScreen_H-KSafeAreaBottomHeight-25-(kStatusBarHeight+66))/2)];
    sendBg.backgroundColor = [UIColor whiteColor];
    sendBg.layer.cornerRadius = 3;
    [oldBgSS addSubview:sendBg];
    
    UILabel * sendTip = [[UILabel alloc]initWithFrame:CGRectMake(0, (sendBg.frame.size.height-40)/2, sendBg.frame.size.width, 40)];
    sendTip.text = @"发送区";
    sendTip.textColor = ColorHex(@"#f0f0f0");
    sendTip.textAlignment = NSTextAlignmentCenter;
    sendTip.font = [UIFont systemFontOfSize:28];
    [sendBg addSubview:sendTip];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.isOtherSeeStatus = YES;
       UILabel * oldshowSSSSTip = [[UILabel alloc]init];
    oldshowSSSSTip.clipsToBounds = YES;
    oldshowSSSSTip.text = @"kass显示区";
    oldshowSSSSTip.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip.hidden = YES;
    [self.view addSubview:oldshowSSSSTip];
    [self.view addSubview:self.pageScrollView];
    _adView = [[UIView alloc]init];
    _adView.layer.cornerRadius = 6;
    _adView.clipsToBounds = YES;
    _adView.backgroundColor = viewback_black;
       UILabel * oldshowSSSSTip1 = [[UILabel alloc]init];
    oldshowSSSSTip1.clipsToBounds = YES;
    oldshowSSSSTip1.text = @"kass显示区";
    oldshowSSSSTip1.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip1.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip1.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip1.hidden = YES;
    [self.view addSubview:oldshowSSSSTip1];
    [self.view addSubview:_adView];
    [self.adView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_offset(0);
        make.height.mas_offset(0);
    }];
    [self.pageScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(self.view);
        make.bottom.equalTo(self.adView.mas_top);
    }];
    
    [self.pageScrollView reloadData];
    _navView = [[UIView alloc]init];
    _navView.backgroundColor = [UIColor clearColor];
       UILabel * oldshowSSSSTip2 = [[UILabel alloc]init];
    oldshowSSSSTip2.clipsToBounds = YES;
    oldshowSSSSTip2.text = @"kass显示区";
    oldshowSSSSTip2.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip2.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip2.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip2.hidden = YES;
    [self.view addSubview:oldshowSSSSTip2];
    [self.view addSubview:_navView];
    
    _navBack = [[UIButton alloc]init];
    [_navBack setImage:KImageNamed(@"ico_nav_back_wite") forState:UIControlStateNormal];
    [_navBack addTarget:self action:@selector(navBackTap) forControlEvents:UIControlEventTouchUpInside];
    [_navView addSubview:_navBack];
    
    _navMore = [[UIButton alloc]init];
    [_navMore setImage:KImageNamed(@"ico_my_nav_more_nor") forState:UIControlStateNormal];
    [_navMore addTarget:self action:@selector(navMoreTap) forControlEvents:UIControlEventTouchUpInside];
    [_navView addSubview:_navMore];
    
    [_navView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_offset(0);
        make.height.mas_offset(KNav_H);
    }];
    
//    _navMessegeView = [[UIView alloc]init];
//    _navMessegeView.backgroundColor = [UIColor clearColor];
//       UILabel * oldshowSSSSTip = [[UILabel alloc]init];
    oldshowSSSSTip.clipsToBounds = YES;
    oldshowSSSSTip.text = @"kass显示区";
    oldshowSSSSTip.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip.hidden = YES;
    [self.view addSubview:oldshowSSSSTip];
    [self.view addSubview:_navMessegeView];
    
    _navMessegeFace= [[UIImageView alloc]init];
    _navMessegeFace.contentMode = UIViewContentModeScaleAspectFill;
    _navMessegeFace.layer.cornerRadius = 17;
    _navMessegeFace.clipsToBounds = YES;
    _navMessegeFace.hidden = YES;
    [_navView addSubview:_navMessegeFace];
    
    _navMessegeNick = [[UILabel alloc]init];
    _navMessegeNick.textColor = [UIColor whiteColor];
    _navMessegeNick.font = FontBold(13);
    _navMessegeNick.hidden = YES;
    [_navView addSubview:_navMessegeNick];
    
    [_navView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_offset(0);
        make.height.mas_offset(KNav_H);
    }];
    
    [_navMore mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_offset(-5);
        make.right.mas_offset(-12);
        make.width.height.mas_offset(34);
    }];
    KWeakSelf
    [_navBack mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_offset(-5);
        make.left.mas_offset(12);
        make.width.height.mas_offset(34);
    }];
    
    [_navMessegeFace mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_offset(-5);
        make.left.equalTo(weakSelf.navBack.mas_right).mas_offset(15);
        make.width.height.mas_offset(34);
    }];
    
    [_navMessegeNick mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_offset(-5);
        make.left.equalTo(weakSelf.navMessegeFace.mas_right).mas_offset(4);
        make.right.equalTo(weakSelf.navMore.mas_left).mas_offset(-15);
        make.width.height.mas_offset(34);
    }];
    
    _other_see_view = [[UIView alloc]init];
    _other_see_view.backgroundColor = subviewback_black;
    _other_see_view.layer.cornerRadius = 5;
    _other_see_view.clipsToBounds = YES;
    _other_see_view.hidden = YES;
    [_other_see_view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(justSeeClick)]];
       UILabel * oldshowSSSSTip3 = [[UILabel alloc]init];
    oldshowSSSSTip3.clipsToBounds = YES;
    oldshowSSSSTip3.text = @"kass显示区";
    oldshowSSSSTip3.textColor = ColorHex(@"#f0f0f0");
    oldshowSSSSTip3.textAlignment = NSTextAlignmentCenter;
    oldshowSSSSTip3.font = [UIFont systemFontOfSize:28];
    oldshowSSSSTip3.hidden = YES;
    [self.view addSubview:oldshowSSSSTip3];
    [self.view addSubview:_other_see_view];
    
    _other_see_label = [[UILabel alloc]init];
    _other_see_label.textColor = [UIColor whiteColor];
    _other_see_label.font = FontBold(12);
    _other_see_label.text = @"刚刚看过";
    _other_see_label.textAlignment = NSTextAlignmentCenter;
    [_other_see_view addSubview:_other_see_label];
    
    _other_see_image = [[UIImageView alloc]init];
    _other_see_image.image = KImageNamed(@"ico_see_refrsh");
    [_other_see_view addSubview:_other_see_image];
    
    [_other_see_view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_offset(-KTab_H-60);
        make.right.mas_offset(-15);
        make.width.mas_offset(98);
        make.height.mas_offset(38);
    }];
    
    [_other_see_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(0);
        make.left.mas_offset(12);
        make.width.mas_offset(54);
        make.height.mas_offset(38);
    }];
    
    [_other_see_image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(12);
        make.left.equalTo(weakSelf.other_see_label.mas_right).mas_offset(6);
        make.right.equalTo(weakSelf.other_see_view.mas_right).mas_offset(-12);
        make.width.height.mas_offset(14);
    }];
    [SVProgressHUDTool showWithStatus:nil];
    [self myMessegeRequest];
    [[QZDataUpdate share] addListenerObj:self];
    

    
    [CSJADLoading share].BannerAdsLoadFish = ^(id  _Nullable bannerView) {
        if(bannerView != nil && weakSelf.adView){
            [weakSelf.adView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_offset(45);
            }];
            [weakSelf.adView addSubview:bannerView];
            [bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.equalTo(weakSelf.adView);
            }];
            [UIView animateWithDuration:0.3 animations:^{
                [weakSelf.view layoutIfNeeded];
            }];
        }
    };
    [CSJADLoading ADBannerAdRequest:self];
}
- (void)myMessegeRequest{
    KMutableDic(sendDic)

    KWeakSelf
    sendDic[@"tomid"] = _otherMid;
    [YBNetBase userhomeRequest:sendDic isMy:NO successBlock:^(NSDictionary * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
        [SVProgressHUDTool dismiss];
        if(code == 200){
            BOOL isStatus = NO;
            if(weakSelf.infoModel == nil){
                isStatus = YES;
            }else{
                [weakSelf.categoryView reloadDataWithoutListContainer];
            }
            [weakSelf.infoModel setValuesForKeysWithDictionary:data];
            [weakSelf changeTitleArr:NO];
            
            [weakSelf.headerView refreshMessege:weakSelf.infoModel];
            [weakSelf.navMessegeFace sd_setImageWithURL:KUrlString(weakSelf.infoModel.face) placeholderImage:weakSelf.navMessegeFace.image];
            weakSelf.navMessegeNick.text = weakSelf.infoModel.nickname;
            
            [weakSelf setHeraderViewHeight];
        }else{
            [YBMsgPop showPop:msg];
        }
    }];
}
- (void)changeTitleArr:(BOOL)isChange{
    if([self.infoModel.isblack intValue] == 1 || [self.infoModel.otherblack intValue] == 1){
        self.titles = @[@""];
        self.images = @[@(0)];
        self.categoryView.imgIndexArr = self.images;
        self.categoryView.titles = self.titles;
        _categoryView.frame = CGRectMake(0, 0, self.view.frame.size.width, 40.0f);
        _categoryView.indicators = @[];
    }else{
        if([self.infoModel.collect_permission intValue] == 1 && [self.infoModel.like_permission intValue] == 1){
            self.images = @[@(0),@(1),@(1)];
            self.titles = @[[NSString stringWithFormat:@"作品 %@",self.infoModel.video_total],[NSString stringWithFormat:@"收藏"], [NSString stringWithFormat:@"喜欢"]];
        }else if([self.infoModel.collect_permission intValue] == 1){
            self.images = @[@(0),@(1),@(0)];
            self.titles = @[[NSString stringWithFormat:@"作品 %@",self.infoModel.video_total],[NSString stringWithFormat:@"收藏"], [NSString stringWithFormat:@"喜欢 %@",self.infoModel.like_num]];
        }else if([self.infoModel.like_permission intValue] == 1){
            self.images = @[@(0),@(0),@(1)];
            self.titles = @[[NSString stringWithFormat:@"作品 %@",self.infoModel.video_total],[NSString stringWithFormat:@"收藏 %@",self.infoModel.collect_num], [NSString stringWithFormat:@"喜欢"]];
        }else{
            self.images = @[@(0),@(0),@(0)];
            self.titles = @[[NSString stringWithFormat:@"作品 %@",self.infoModel.video_total],[NSString stringWithFormat:@"收藏 %@",self.infoModel.collect_num], [NSString stringWithFormat:@"喜欢 %@",self.infoModel.like_num]];
        }
        self.categoryView.imgIndexArr = self.images;
        self.categoryView.titles = self.titles;
        _categoryView.frame = CGRectMake(0, 0, self.view.frame.size.width, 40.0f);
        _categoryView.indicators = @[_lineView];
    }
    if(isChange){
        [self.categoryView reloadData];
        [self.pageScrollView reloadData];
    }else{
        [self.categoryView reloadData];
    }
}
- (void)setHeraderViewHeight{
    CGFloat height = KNav_H+271;
    height = height+self.headerView.introHeight;
    if(self.headerView.showOtherTags == NO){
        height = height-20;
    }
    self.headerView.frame = CGRectMake(0, 0, KScreen_W, height);
    
    self.otherVideoVC.headerHeigh = self.headerView.frame.size.height;
    [self.pageScrollView refreshHeaderView];
}
#pragma mark - 事件
- (void)navBackTap{
    if(self.ispresend){
        [self.navigationController dismissViewControllerAnimated:YES completion:nil];
    }else{
        [self.navigationController popViewControllerAnimated:YES];
    }
}
- (void)navMoreTap{
    SharePopView *popView = [[SharePopView alloc] init];
    if([self.infoModel.otherblack intValue] == 0){
        popView.bottomIconsName = @[@"ico_mine_more_share",@"ico_mine_more_jubao",@"ico_mine_more_back"];
        popView.bottomTexts = @[@"分享",@"举报",@"拉黑"];
    }else{
        popView.bottomIconsName = @[@"ico_mine_more_share",@"ico_mine_more_jubao",@"ico_mine_more_jiechu"];
        popView.bottomTexts = @[@"分享",@"举报",@"解除"];
    }

    popView.delegate = self;
    [popView show];
}
#pragma mark - GKPageTableViewGestureDelegate
- (BOOL)pageTableView:(GKPageTableView *)tableView gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    // 禁止UIScrollView左右滑动时，上下左右都可以滑动
    if(otherGestureRecognizer == self.categoryView.collectionView.panGestureRecognizer||otherGestureRecognizer == self.categoryView.contentScrollView.panGestureRecognizer){
        return NO;
    }
    if([otherGestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]]){
        return NO;
    }
    if (otherGestureRecognizer.view.tag == 60) {
        return NO;
    }
    return [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]];
}
- (void)mainTableViewDidScroll:(UIScrollView *)scrollView isMainCanScroll:(BOOL)isMainCanScroll {
    CGFloat offsetY = scrollView.contentOffset.y;
    if(offsetY > KNav_H+20){
        if(_navMessegeFace.hidden){
            _navView.backgroundColor = viewback_black;
            _navMessegeFace.hidden = NO;
            _navMessegeNick.hidden = NO;
        }
        
    }else{
        if(_navMessegeFace.hidden == NO){
            _navView.backgroundColor = [UIColor clearColor];
            _navMessegeFace.hidden = YES;
            _navMessegeNick.hidden = YES;
        }
    }
    [self.headerView.background mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headerView).mas_offset(offsetY);
    }];
    
    if(self.otherVideoVC != nil){
        self.otherVideoVC.mainScrollY = offsetY;
    }
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    [self.pageScrollView horizonScrollViewWillBeginScroll];
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    [self.pageScrollView horizonScrollViewDidEndedScroll];
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
    [self.pageScrollView horizonScrollViewDidEndedScroll];
}
#pragma mark - GKPageScrollViewDelegate
- (BOOL)shouldLazyLoadListInPageScrollView:(GKPageScrollView *)pageScrollView {
    return YES;
}
- (UIView *)headerViewInPageScrollView:(GKPageScrollView *)pageScrollView {
    return self.headerView;
}

- (UIView *)segmentedViewInPageScrollView:(GKPageScrollView *)pageScrollView {
    return self.categoryView;
}

- (NSInteger)numberOfListsInPageScrollView:(GKPageScrollView *)pageScrollView {
    return self.titles.count;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{

    if(index == 0){
        self.other_see_view.hidden = self.isOtherSeeStatus;
    }else{
        self.other_see_view.hidden = YES;
    }
}
- (id<GKPageListViewDelegate>)pageScrollView:(GKPageScrollView *)pageScrollView initListAtIndex:(NSInteger)index {
    if([self.infoModel.otherblack intValue] == 1 || [self.infoModel.isblack intValue] == 1){
        QZOtherMyBlackVC * black = [[QZOtherMyBlackVC alloc] init];
        black.headerHeigh = self.headerView.frame.size.height;
        black.mainScrollY = 0;
        black.isBloack = self.infoModel.isblack;
        black.otherBlack = self.infoModel.otherblack;
        return black;
    }
    if(index == 1 && [self.infoModel.collect_permission intValue] == 1){
        QZOtherMyPriVC * black = [[QZOtherMyPriVC alloc] init];
        black.headerHeigh = self.headerView.frame.size.height;
        black.mainScrollY = 0;
        black.priType = 1;
        return black;
    }
    if(index == 2 && [self.infoModel.like_permission intValue] == 1){
        QZOtherMyPriVC * black = [[QZOtherMyPriVC alloc] init];
        black.headerHeigh = self.headerView.frame.size.height;
        black.mainScrollY = 0;
        black.priType = 2;
        return black;
    }
    if(index == 0){
        self.otherVideoVC = [[QZOtherMyVideoVC alloc] init];
        self.otherVideoVC.otherMid = self.otherMid;
        self.otherVideoVC.otherVid = self.otherVid;
        self.otherVideoVC.headerHeigh = self.headerView.frame.size.height;
        self.otherVideoVC.mainScrollY = 0;
        KWeakSelf
        self.otherVideoVC.otherJustSeeHiddnBlock = ^(bool hidden, BOOL isDown) {
            weakSelf.isOtherSeeStatus = hidden;
            if(isDown){
                weakSelf.other_see_image.image = KImageNamed(@"ico_see_down");
            }else{
                weakSelf.other_see_image.image = KImageNamed(@"ico_see_up");
            }
            if(weakSelf.categoryView.selectedIndex == 0){
                weakSelf.other_see_view.hidden = weakSelf.isOtherSeeStatus;
            }
        };
        return self.otherVideoVC;
    }else if (index == 1){
        QZMyCollectionVC *listVC = [[QZMyCollectionVC alloc] init];
        listVC.headerHeigh = self.headerView.frame.size.height;
        listVC.otherMid = self.otherMid;
        return listVC;
    }else{
        QZMyLikeVC *listVC = [[QZMyLikeVC alloc] init];
        listVC.headerHeigh = self.headerView.frame.size.height;
        listVC.otherMid = self.otherMid;
        return listVC;
    }
}
- (void)justSeeClick{
    [self.pageScrollView scrollToCriticalPointAnimated:NO];
    [self.otherVideoVC jusSeeScrollToSeeVideo:self.other_see_image];
}
#pragma mark - 懒加载
- (QZUserInfoModel *)infoModel{
    if(_infoModel == nil){
        _infoModel = [[QZUserInfoModel alloc]init];
    }
    return _infoModel;
}
- (GKPageScrollView *)pageScrollView {
    if (!_pageScrollView) {
        _pageScrollView = [[GKPageScrollView alloc] initWithDelegate:self];
        _pageScrollView.backgroundColor = viewback_black;
        _pageScrollView.mainTableView.backgroundColor = viewback_black;
        _pageScrollView.listContainerView.backgroundColor = viewback_black;
        _pageScrollView.pageView.backgroundColor = [UIColor redColor];
        _pageScrollView.lazyLoadList = YES;
        _pageScrollView.ceilPointHeight = KNav_H;
    }
    return _pageScrollView;
}

- (QZOtherMyMessegeView *)headerView {
    if (!_headerView) {
        _headerView = [[QZOtherMyMessegeView alloc] initWithFrame:CGRectMake(0, 0, KScreen_W, KNav_H+245)];
        KWeakSelf
        _headerView.myOtherMessegeHeaderBlock = ^(NSInteger index) {
            if(index == 0){
                //展开收起
                [weakSelf.headerView refreshMessege:weakSelf.infoModel];
                [weakSelf setHeraderViewHeight];
            }else if (index == 1){
                [YBMsgPop showPop:[NSString stringWithFormat:@"收到%@赞",[Tools NumberToShowString:[[QZUserInfoModel share].total_like integerValue]]]];
            }else if (index == 2){
                if([weakSelf.infoModel.follow_permission intValue] == 1){
                    [YBMsgPop showPop:@"对方已设置隐私，不能访问关注列表"];
                    return;
                }
                QZMyFansVC * vc = [[QZMyFansVC alloc]init];
                vc.listType = 0;
                vc.otheMid = weakSelf.otherMid;
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }else if (index == 3){
                if([weakSelf.infoModel.follow_permission intValue] == 1){
                    [YBMsgPop showPop:@"对方已设置隐私，不能访问粉丝列表"];
                    return;
                }
                QZMyFansVC * vc = [[QZMyFansVC alloc]init];
                vc.listType = 1;
                vc.otheMid = weakSelf.otherMid;
                [weakSelf.navigationController pushViewController:vc animated:YES];
            }else if (index == 4){
                //关注
                [weakSelf followsUser];
            }
        };
    }
    return _headerView;
}
- (void)followsUser{
    if([self.infoModel.otherblack intValue] == 1){
        [YBMsgPop showPop:@"你已拉黑Ta，不能关注"];
        return;
    }
    KWeakSelf
    KMutableDic(sendDic)
    [sendDic setObject:self.otherMid forKey:@"to_mid"];
    [YBNetBase userFollowUserRequest:sendDic target:[Tools currentActiveController] successBlock:^(NSDictionary * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
        if(code == 200){
            if([weakSelf.infoModel.isfollow intValue] == 1){
                weakSelf.infoModel.isfollow = @(0);
 
                [YBMsgPop showPop:@"已取消关注"];
            }else{
                weakSelf.infoModel.isfollow = @(1);

                [YBMsgPop showPop:NSLocalizedString(@"已关注", nil)];
            }
            [weakSelf.headerView refreshMessege:weakSelf.infoModel];
        }else{
            [YBMsgPop showPop:msg];
        }
    }];
}
- (QZMyTitleView *)categoryView {
    if (!_categoryView) {
        _categoryView = [[QZMyTitleView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40.0f)];
        _categoryView.backgroundColor = viewback_black;
        _categoryView.imgName_nor = @"ico_title_lock_full_nor";
        _categoryView.imgName_sel = @"ico_title_lock_full_sel";
        _categoryView.imgIndexArr = @[@(0),@(0),@(0)];
        _categoryView.titles = self.titles;
        _categoryView.delegate = self;
        _categoryView.clipsToBounds = YES;
        _categoryView.titleColor = [UIColor grayColor];
        _categoryView.titleSelectedColor = [UIColor whiteColor];
        _categoryView.titleFont = [UIFont systemFontOfSize:16.0f];
        _categoryView.titleSelectedFont = [UIFont systemFontOfSize:16.0f];
        
        _lineView = [[JXCategoryIndicatorLineView alloc] init];
        _lineView.indicatorColor = [UIColor whiteColor];
        _lineView.indicatorWidth = 30.0f;
        _lineView.indicatorCornerRadius = 0;
        _lineView.verticalMargin = 5;
        _lineView.lineStyle = JXCategoryIndicatorLineStyle_Normal;
        _categoryView.indicators = @[_lineView];
        _categoryView.defaultSelectedIndex = 0;
        
        _categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pageScrollView.listContainerView;
        
        // 添加分割线
//        UIView *btmLineView = [UIView new];
//        btmLineView.backgroundColor = COLOR_ALPH(255, 255, 255, 0.5);
//        [_categoryView addSubview:btmLineView];
        
//        [btmLineView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.bottom.equalTo(self->_categoryView);
//            make.height.mas_equalTo(0.5);
//        }];
    }
    return _categoryView;
}

- (UILabel *)titleView {
    if (!_titleView) {
        _titleView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 160, 44)];
        _titleView.font = [UIFont systemFontOfSize:18.0f];
        _titleView.textColor = [UIColor whiteColor];
        _titleView.text = @"❤️会说话的刘二豆❤️";
        _titleView.alpha = 0;
    }
    return _titleView;
}
#pragma mark 更多代理事件
#pragma mark - SharePopViewDelegate
- (void)actionClickedAtIndex:(NSInteger)index type:(NSString *)type
{
    if([type isEqualToString:@"分享"]){
        //分享
        [Tools iosSystemShare:@[[NSURL URLWithString:SHAREURL]] sourceView:self.view success:^{
            [YBMsgPop showPop:@"分享成功"];
        } fail:^{
            [YBMsgPop showPop:@"分享失败"];
        }];
    }else if ([type isEqualToString:@"举报"]){
        //举报
        DJJubaoVC * jubao = [[DJJubaoVC alloc]init];
        jubao.type = YVUserReport;
        jubao.reportId = self.otherMid;
        [[Tools currentActiveController].navigationController pushViewController:jubao animated:YES];
    }else if ([type isEqualToString:@"拉黑"]){
        KMutableDic(sendDic)
        KWeakSelf
        [sendDic setObject:self.otherMid forKey:@"tomid"];
        [YBNetBase userBlackUserRequest:sendDic userid:self.otherMid target:[Tools currentActiveController] successBlock:^(NSDictionary * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
            if(code == 200){
                weakSelf.infoModel.otherblack = @(1);
                if([weakSelf.infoModel.isfollow intValue] == 1){
                    weakSelf.infoModel.isfollow = @(0);
                    [weakSelf.headerView refreshMessege:weakSelf.infoModel];
                }
                [weakSelf changeTitleArr:YES];
                [YBMsgPop showPop:@"已拉黑"];
            }else{
                [YBMsgPop showPop:msg];
            }
        }];
    }else if ([type isEqualToString:@"解除"]){
        KWeakSelf
        KMutableDic(sendDic)
        [sendDic setObject:self.otherMid forKey:@"to_mid"];
        [YBNetBase userCloseBlackUserRequest:sendDic userid:self.otherMid target:weakSelf successBlock:^(NSDictionary * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
            if(code == 200){
                weakSelf.infoModel.otherblack = @(0);
                [weakSelf changeTitleArr:YES];
                [YBMsgPop showPop:@"已取消拉黑"];
            }else{
                [YBMsgPop showPop:msg];
            }
        }];
    }

}
@end
